import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import fire from '@dfeidao/atom-web/msg/fire';

export default async function a004(fd: IFeidaoAiBrowserComponent) {
	// todo
	// data-id="plan"
	const plan_node = fd.data.node.querySelector<HTMLSelectElement>('[data-id="plan"]');
	const plan = plan_node.value;
	// console.log(plan);
	let plan_name = '';
	if (plan === '请选择') {
		alert('请先选择计划分类属性名称');
		return;
	} else {
		plan_name = plan_node.selectedOptions[0].text;
		// console.log(plan_name);
	}
	// data-id="type"
	const type_node = fd.data.node.querySelector<HTMLSelectElement>('[data-id="type"]');
	const type = type_node.value;
	// console.log(type);
	let type_name = "";
	if (type === '请选择') {
		alert('请先选择计划类型名称');
		return;
	} else {
		type_name = type_node.selectedOptions[0].text;
		// console.log(type_name);
	}
	const data = { plan, type };
	fire('zj-000006', 'a001', data, 'add');
}
